package com.SparkCore.Test

import java.io.{InputStream, ObjectInputStream, ObjectOutputStream}
import java.net.{ServerSocket, Socket}

object Executor {

  def main(args: Array[String]): Unit = {

    //启动服务器， 接收数据
    val server = new ServerSocket(1234)
    println("服务器1234启动，准备接收数据")

    //等待客户端的连接
    val client: Socket = server.accept()
    val in: InputStream = client.getInputStream

    val objIn = new ObjectInputStream(in)
    val task = objIn.readObject().asInstanceOf[SubTask]
    val ints = task.compute()
    println("计算节点[1234]结果是： " + ints)

    objIn.close()
    client.close()
    server.close()
  }
}
